package com.shan.thread;

/**
 * description
 * 接口实现线程
 *
 * @author shanzheng <br/>
 * @date 16:04 2019/1/11.<br/>
 * Modified By <br/>
 */
public class CommonRunnable {
    public static void main(String[] args) {
        TestRunnable testRunnable1 = new TestRunnable();
//        Thread thread1 = new Thread(testRunnable1,"线程A");
        new Thread(testRunnable1, "线程A").start();
//        thread1.start();// 启动线程
        testRunnable1.run();// 直接调用run()方法

    }


}

/**
 * Description 内部类
 *
 * @author shanzheng
 * date  2019/1/11
 * @return
 */
class TestRunnable implements Runnable {
    /**
     * currentThread() 获取当前正在运行线程对象
     */
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(i + "===>" + Thread.currentThread().getName());
        }
    }
}


